package xyz.xtt.admin.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import xyz.xtt.admin.entity.TblChainTransaction;
import xyz.xtt.admin.service.IChainTransactionService;
import xyz.xtt.admin.utils.PageUtilV2;
import xyz.xtt.common.response.ApiResult;

import java.util.Optional;

/**
 * <p>
 * 区块链交易表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-11-21
 */
@RestController
@RequestMapping("/api/admin/chain_transaction")
public class ChainTransactionController {

    @Autowired
    private IChainTransactionService chainTransactionService;
    @Autowired
    private PageUtilV2 pageUtil;

    @GetMapping("/list")
    public ApiResult<Page<TblChainTransaction>> list(Integer current, Integer pageSize,Integer status, String searchType) {
        current =  pageUtil.getCurrent(current);
        pageSize = pageUtil.getPageSize(pageSize);
        searchType = StringUtils.isNotBlank(searchType) ? searchType : null;
        return ApiResult.ok(chainTransactionService.getList(current, pageSize,status,searchType));
    }
}
